﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wp.BLL;
using Wp.DAL;

public partial class Controls_CenterNewsChildItem : System.Web.UI.UserControl
{
    public string TermTaxonomyTextId { get; set; }
    public string CssClass { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    public void LoadData()
    {
        TblTermsEntity item = TblTermsManager.CreateInstant().SelectOneSlug(TermTaxonomyTextId);
        if (item != null)
            LiteralTitle.Text = item.Name;
        int TotalRow = 0;
        int numberitemnewhome = Wp.BLL.TblOptionManager.CreateInstant().GetOption("number-items-new-home").Trim().ToInt();
        List<TblPostsEntity> ls = TblPostsManager.CreateInstant().SelectTblPostBy("post", "", -1, TermTaxonomyTextId, "category", "CreatedDate", "DESC", numberitemnewhome, 1, out TotalRow);
        rpt.DataSource = ls.Take(1);
        rpt.DataBind();
        rpt2.DataSource = ls.Skip(1).Take(numberitemnewhome-1);
        rpt2.DataBind();
    }
}